import { Tag, TagProps } from "antd";
import React from "react";

export type ColorText = {
    text?: string;
    color?: TagProps["color"]
}

export type HTagProps = {
    value: any;
    tagStype?: boolean;
    mapping: { [key: string]: ColorText };
}
export const KnowTag = {
    text: "/",
    color: "default"
}

export default class HTag extends React.Component<HTagProps, any> {

    render() {
        const { text, color } = this.props.mapping[this.props.value] || KnowTag

        return <>
            {
                this.props.tagStype ? <Tag color={color}>
                    {text}
                </Tag> : <span>{text}</span>
            }

        </>
    }
}